package com.yi.servicedriveruser.controller;


import com.yi.internalcommon.dto.Car;
import com.yi.internalcommon.dto.ResponseResult;
import com.yi.servicedriveruser.service.CarService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 田毅
 * @since 2022-08-05
 */
@RestController
@RequestMapping("/car")
@Slf4j
public class CarController {

    @Autowired
    private CarService carService;
    /**
     * 添加车辆信息
     */
    @PostMapping
    public ResponseResult addCar(@RequestBody Car car){
        ResponseResult result = carService.addCar(car);
        return result;
    }
    /**
     * 根据id查询车辆信息
     * @param carId
     * @return
     */
    @GetMapping
    public ResponseResult getCarById(Long carId){
        return carService.getCarById(carId);
    }

}
